﻿using Microsoft.EntityFrameworkCore;
using Microsoft.EntityFrameworkCore.Design;

namespace WebCoreAPI.Identity
{
    public class MyDesignDBContextFac : IDesignTimeDbContextFactory<MyDbContext>
    {
        public MyDbContext CreateDbContext(string[] args)
        {
            DbContextOptionsBuilder<MyDbContext> builder = new DbContextOptionsBuilder<MyDbContext>();
            string? mySqlConStr = "server=82.157.168.172;database=IdentityDemo;uid=feng;pwd=123456Feng!;charset=utf8;";
            builder.UseMySql(mySqlConStr, ServerVersion.AutoDetect(mySqlConStr))
                   .EnableDetailedErrors().EnableSensitiveDataLogging();
            return new MyDbContext(builder.Options);
        }
    }
}
